package com.itheima.app.interceptor;

import com.itheima.domain.db.User;

/**
 * @Author 请不要叫我高司令
 * @Date 2022/3/14 22:15
 * @Version 1.0
 */


public class UserHolder {

    private static final ThreadLocal<User> THREAD_LOCAL = new ThreadLocal<>();

    //设置user
    public static void set(User user) {
        THREAD_LOCAL.set(user);
    }


    //获取user
    public static User get() {
        return THREAD_LOCAL.get();
    }

    //删除user
    public static void remove() {
        THREAD_LOCAL.remove();
    }

}
